package com.kun.controller;

import com.kun.common.domain.AjaxResult;
import com.kun.domain.TUserFollowing;
import com.kun.service.service.ITUserFollowingService;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/t-user-followings")
public class TUserFollowingController extends BaseController {

    private final ITUserFollowingService itUserFollowingService;

    public TUserFollowingController(ITUserFollowingService itUserFollowingService) {
        this.itUserFollowingService = itUserFollowingService;
    }

    /**
     * 添加用户关注
     */
    @PostMapping
    public ResponseEntity<AjaxResult> addUserFollowings(@Validated @RequestBody TUserFollowing tUserFollowing) {
        return success(itUserFollowingService.addUserFollowings(tUserFollowing));
    }

    /**
     * 获取用户关注列表
     */
    @GetMapping("/follow")
    public ResponseEntity<AjaxResult> getUserFollowings() {
        return success(itUserFollowingService.getUserFollowings());
    }

    /**
     * 获取用户粉丝列表
     */
    @GetMapping("/fans")
    public ResponseEntity<AjaxResult> getUserFans() {
        return success(itUserFollowingService.getUserFans());
    }

    /**
     * 分页获取用户信息列表
     */
    @GetMapping("/pageUserInfo")
    public ResponseEntity<AjaxResult> pageUserInfo(TUserFollowing tUserFollowing) {
        return success(itUserFollowingService.pageUserInfo(tUserFollowing));
    }

}
